<template>
  <div class="app-container">
    <el-form ref="form" :model="form" label-width="120px">
      <el-form-item label="姓名">
        <el-input v-model="form.name" />
      </el-form-item>
      <el-form-item label="分数">
        <el-input v-model="form.score" />
      </el-form-item>
      
      <el-form-item label="性别">
        <el-radio-group v-model="form.gender">
          <el-radio label="1">男</el-radio>
          <el-radio label="2">女</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">确定修改</el-button>
        <el-button @click="onCancel">Cancel</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import {stuEdit} from '@/api/stu'
export default {
  data() {
    return {
      form: {
        name: '',
        score:'',
        gender:""
      }
    }
  },
  created () {
    console.log(this.$route.query);
    this.form = this.$route.query
  },
  methods: {
    onSubmit() {
      console.log(this.form);
      stuEdit(this.form).then(res=>{
          console.log(res);
      })
    },
    onCancel() {
      this.$message({
        message: 'cancel!',
        type: 'warning'
      })
    }
  }
}
</script>

<style scoped>
.line{
  text-align: center;
}
</style>

